$().ready(function () {
// 在键盘按下并释放及提交后验证提交表单，根据name
    $("#regForm").validate({
        rules: {
            phonenumber: {
                required: true,
                rangelength: [11, 11],
                digits: true,
                remote: {
                    type: "POST",
                    url: "/user/register/checkPhone" //请求地址
                    }
            },
            recPhone: {
                required: true,
                rangelength: [11, 11],
                digits: true
            },
            password: {
                required: true,
                minlength: 6
            },
            passwordconfirm: {
                required: true,
                minlength: 6,
                equalTo: "#regPwd"
            },

            nickname: {
                required: true,
                minlength: 2
            },
            recName: {
                required: true,
                minlength: 2
            },
            recAddress: "required",
            // preference: "required",
            birthdate: {
                dateISO: true
            }
        },
        messages: {
            phonenumber: {
                required: "请输入手机号",
                rangelength: "手机号必须为11位",
                digits: "手机号必须为数字",
                remote: "用户名已存在"
            },
            recPhone: {
                required: "请输入收货人手机号",
                rangelength: "手机号必须为11位",
                digits: "手机号必须为数字"
            },
            password: {
                required: "请输入密码",
                minlength: "密码长度不能小于 6"
            },
            passwordconfirm: {
                required: "请确认密码",
                equalTo: "两次输入密码不一致",
                minlength: "密码长度不能小于 6"
            },
            nickname: {
                required: "请输入昵称",
                minlength: "昵称长度不能小于 2 位"
            },
            recName: {
                required: "请输入姓名",
                minlength: "姓名长度不能小于 2 位"
            },
            recAddress: "请输入收货地址",
            birthdate: "请输入有效的日期"
        }
    })
});